package src.com.changli.d_for;

import java.util.Scanner;

public class Demo3PrimeNumber {
    public static void main(String[] args) {
        int primeCnt = 0;
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        //判断N里面的质数个数
        long start = System.currentTimeMillis();
        for(int i=1;i<=n;i++){
            boolean isPrime = true;
            for(int j = 2;j<=Math.sqrt(i);j++){

                if(i%j==0){
                    isPrime = false;
                    break;
                }
            }
            if (isPrime){
                primeCnt++;
            }
            isPrime = true;
        }
        long end = System.currentTimeMillis();
        System.out.println(n+"之内的质数个数为："+primeCnt);
        System.out.println("花费的时间为:"+ (end-start)+"ms");
    }
}
